import { BaseWindow } from "../../../component/window/BaseWindow";
import { ObjCreate } from "../common/ObjCreate";
import { Language } from "../../../../extend/language/Language";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
import { GlobalClass } from "../../../../com/mui/core/GlobalClass";
import { GButton } from "../../../../com/mui/controls/GButton";
import { Dispatcher } from "../../../mvc/core/Dispatcher";
import { DataEvent } from "../../events/DataEvent";
import { MailEventName } from "./MailEventName";
import { GTextInput } from "../../../../com/mui/controls/GTextInput";
type int = number;
//class InputMoneyPanel
    
    export  class InputMoneyPanel extends BaseWindow
    {
        constructor()
        {
            super();
            this.init();
            return;
        }

        public init(): void
        {
            titleHeight = 30;
            this.setSize(248, 120);
            this._titleText = ObjCreate.createTextField(Language.getString(52015), 92, 10, 220, 20, this, GlobalStyle.dialogTitle);
            this.title = this._titleText;
            this._goldInput = ObjCreate.createGTextInput(33, 50, 178, 20, this);
            this._goldInput.restrict = "0-9";
            this._goldInput.maxChars = 8;
            this._goldInput.text = "0";
            this._goldBitmap = GlobalClass.getBitmap("Yuanbao");
            this._goldBitmap.x = 185;
            this._goldBitmap.y = 50;
            this.addChild(this._goldBitmap);
            this._coinInput = ObjCreate.createGTextInput(120, 50, 90, 20, null);
            this._coinInput.restrict = "0-9";
            this._coinInput.maxChars = 8;
            this._coinInput.text = "0";
            this._coinBitmap = GlobalClass.getBitmap("Tongqian");
            this._coinBitmap.x = 187;
            this._coinBitmap.y = 50;
            this._okBtn = new GButton();
            this._okBtn.label = Language.getString(52012);
            this._okBtn.styleName = "Button";
            this._okBtn.setSize(46, 27);
            this._okBtn.move(54, 80);
            this._okBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onOkBtnClickHandler);
            this.addChild(this._okBtn);
            this._cancelBtn = new GButton();
            this._cancelBtn.label = Language.getString(52013);
            this._cancelBtn.styleName = "Button";
            this._cancelBtn.setSize(46, 27);
            this._cancelBtn.move(144, 80);
            this._cancelBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onCancelBtnClickHandler);
            this.addChild(this._cancelBtn);
            return;
        }

        /* internal  */onOkBtnClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(MailEventName.INPUT_MONEY_OK, {"coin": this._coinInput.text, "gold": this._goldInput.text}));
            this.onCancelBtnClickHandler(null);
            return;
        }

        /* internal  */onCancelBtnClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            this.hide();
            return;
        }

        public get coin(): int
        {
            this._coin = int(this._coinInput.text);
            return this._coin;
        }

        public get gold(): int
        {
            this._gold = int(this._goldInput.text);
            return this._gold;
        }

        /* internal */ /* var */_titleText: Object /* flash.text.TextField */;

        /* internal */ /* var */_goldInput: GTextInput;

        /* internal */ /* var */_coinInput: GTextInput;

        /* internal */ /* var */_goldBitmap: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_coinBitmap: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_okBtn: GButton;

        /* internal */ /* var */_cancelBtn: GButton;

        /* internal */ /* var */_coin: int;

        /* internal */ /* var */_gold: int;
    }
